import {Filter} from "./Filter";
import {Feature, GeoJSONObject} from "@turf/helpers";

export class PropertyEqFilter implements Filter {

    protected key: string;

    protected value: string;

    constructor(key: string, value: string) {
        this.key = key;
        this.value = value;
    }

    filter(feature: Feature): boolean {
        if (this.key in feature.properties) {
            return feature.properties[this.key] === this.value
        } else {
            return false;
        }
    }
}
